<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>调动管理</title>
<script type="text/javascript" src="static/easyui/jquery.min.js"></script>
<script type="text/javascript" src="static/easyui/jquery.easyui.min.js"></script>
<script type="text/javascript" src="static/easyui/locale/easyui-lang-zh_CN.js"></script>
<link rel="stylesheet" href="static/easyui/themes/icon.css">
<link rel="stylesheet" href="static/easyui/themes/metro/easyui.css">
	<style type="text/css">
			.add-dd{
				color: #19AA8D;
				border:1px solid #1AB394;
			}
			/* 带调动里面的信息 */
			.transfer-ddsp{
				color: #19AA8D;
				border:1px solid #1AB394;
			}
			.transfer-xg{
				color: #19AA8D;
				border:1px solid #1AB394;
			}
			.transfer-fqdd{
				color: red;
				border:1px solid #1AB394;
			}
			/* 调动审批里面的样式 */
			.dd-tjsp{
				color: #19AA8D;
				border:1px solid #1AB394;
			}
			.dd-bh{
				color: red;
				border:1px solid #1AB394;
			}
			/* 调动结果里面的 */
			.ddjg-ck{
				color: #19AA8D;
				border:1px solid #1AB394;
			}
			/* 调动记录里面的信息 */
			.ddjl-ck{
				color: #19AA8D;
				border:1px solid #1AB394;
			}
	</style>
</head>
<body>
	<script type="text/javascript">
		function add(text){
			$("#content-admin").panel({
				href:text
			});
		}
		function addentry(){
			add("ljj-transferadd");
		}
		function addtransfer(){
			$("#sqdd-transfer").window("open");	
			$("#transfer-gb").linkbutton({onClick : function(){
				$("#sqdd-transfer").window("close");
			}});
		}
		//打开调动审核
		function transferdd(Approval_id){
			alert(Approval_id);
			$("#transferddd").form('load',"transfer-Byid?Approval_id="+Approval_id);
			$("#shdd-transfer").window("open");	
			$("#transfer-gb").linkbutton({onClick : function(){
				$("#shdd-transfer").window("close");
			}});
		}
		$(function(){
			$('#transfer-table').datagrid({
			    url:'transfer-list',
			    columns:[[
					{field:'Approval_id',title:'调动编号',width:100,align:'center'},
					{field:'staff_id',title:'员工编号',width:150,align:'center'},
					{field:'Staff_name',title:'调动员工名称',width:150,align:'center'},
					{field:'Approval_state',title:'审核状态',width:150,align:'center'},
					{field:'Approval_time',title:'调动时间',width:150,align:'center'},
					{field:'transfertypes_name',title:'调动类型',width:150,align:'center'},
					{field:'oldpname',title:'调动前部门',width:150,align:'center'},
					{field:'newpname',title:'调动后部门',width:150,align:'center'},
					{field:'olddepatname',title:'调动前职位',width:150,align:'center'},
					{field:'newdeptname',title:'调动后职位',width:150,align:'center'},
					{field:'caozuo',title:'操作',width:200,align:'center',
						formatter: function(value,row,index){
							return "<input type='button' onclick='transferdd("+row['Approval_id']+")'  style='width: 60px;height: 20px;font-size:12px;border-radius:4px;margin-right:5px;color:#fff;background-color:#18A689;border:1px solid #18A689;' value='审核'/>";
						},
					}
			    ]],
			    pagination:true,
			    pageNumber:1,
			    pageSize:5,
			    pageList:[5,10,15]
			});
			//调动结果信息
			$('#transferjg-table').datagrid({
			    url:'transfer-listjg',
			    columns:[[
					{field:'Approval_id',checkbox:true,title:'调动编号',width:100,align:'center'},
					{field:'staff_id',title:'员工编号',width:150,align:'center'},
					{field:'Staff_name',title:'调动员工名称',width:150,align:'center'},
					{field:'Approval_state',title:'审核状态',width:150,align:'center'},
					{field:'Approval_time',title:'调动时间',width:150,align:'center'},
					{field:'transfertypes_name',title:'调动类型',width:150,align:'center'},
					{field:'oldpname',title:'调动前部门',width:150,align:'center'},
					{field:'newpname',title:'调动后部门',width:150,align:'center'},
					{field:'olddepatname',title:'调动前职位',width:150,align:'center'},
					{field:'newdeptname',title:'调动后职位',width:150,align:'center'},
					{field:'caozuo',title:'操作',width:200,align:'center',
						formatter: function(value,row,index){
							return "<input type='button' onclick='transferdd("+row['approval_id']+")'  style='width: 60px;height: 20px;font-size:12px;border-radius:4px;margin-right:5px;color:#fff;background-color:#18A689;border:1px solid #18A689;' value='查看'/>";
						},
					}
			    ]],
			    pagination:true,
			    pageNumber:1,
			    pageSize:5,
			    pageList:[5,10,15]
			});
			//签订审核ajax
			$("#transfer-qianding").linkbutton({onClick : function(){
				alert($("#approval_id").textbox("getValue"));
				  $.ajax({
			         type:"post",//type可以为post也可以为get
			         url:"shenhe-transfer",
			         data:{approval_id:$("#approval_id").textbox("getValue")
			        	   },
			         success:function(data){
			        	 alert("审核成功");
			             $("#shdd-transfer").window("close");
			             $("#transfer-table").datagrid("reload");
			         }
			     });
				
			}});  
		});
	</script>
	<div id="tt" class="easyui-tabs" style="height:580px;">
	
	
	    <div title="调动审批" style="padding:2px;display:none;">
	    <a id="add-dd"  onClick='addentry()' class="easyui-linkbutton" data-options="iconCls:'icon-add'">发起调动</a>
				<!-- 审批表格 -->
				<table id="transfer-table" class="easyui-datagrid" style="height: 500px">   
				</table>  
	    </div>
	    
	    
	    <div title="调动结果" style="display:none;">
			
			
			<table id="transferjg-table" class="easyui-datagrid" style="height: 510px">   
				</table>
	    </div>

</div>

 <div id="shdd-transfer" class="easyui-window" title="审核" style="width:800px;height:300px;" 
		data-options="modal:true,collapsible:false,minimizable:false,maximizable:false,closed:true,draggable:false">
			<Form  action="rank-shenhe" id="transferddd" method="post">
		        	<table width="600px" style="padding: 5px 5px 2px 3px;height:130px;">
		        		<tr>
		        			<td><input id="approval_id"  name="approval_id" class="easyui-textbox" data-options="label:'调动编号',width:280,labelAlign:'right',required:true"/></td>
		        		</tr>
		        		<tr>
		        			<td><input id="approval_time"  name="approval_time" class="easyui-textbox" data-options="label:'调动名称',width:280,labelAlign:'right',required:true"/></td>
		        		</tr>
		        		<tr>
		        			<td><input id="approval_state"  name="approval_state" class="easyui-textbox" data-options="label:'调动状态',width:280,labelAlign:'right',required:true"/></td>
		        		</tr>
		        	</table>
		        	<div style="text-align: center;margin: 10px 1px 1px 1px">
					<a id="transfer-gb" class="easyui-linkbutton" data-options="width:100">取消</a>
					<a id="transfer-qianding"  class="easyui-linkbutton" data-options="width:100">确定调动</a>
					</div>
				 </Form>
		</div>
</body>
</html>